package com.example.zhinongbao.Model;

import android.content.Context;

import com.example.zhinongbao.contract.IPersonalCenter;
import com.example.zhinongbao.database.DBHelper;
import com.example.zhinongbao.database.UserInfoDao;
import com.example.zhinongbao.entity.UserInfo;


public class PersonalCenterImpl implements IPersonalCenter {
    private DBHelper dbHelper;
    private UserInfoDao userInfoDao;

    public PersonalCenterImpl(Context context) {
        dbHelper = new DBHelper(context);
        userInfoDao =new UserInfoDao(context);
    }


    @Override
    public UserInfo getUserByName(String username) {
        return userInfoDao.getUserByName(username);
    }

    @Override
    public void updateID(String username, String newuserid) {
        userInfoDao.updateIdByUserName(username, newuserid);
    }

    @Override
    public void updateAge(String username, String age) {
        userInfoDao.updateAgeByUserName(username, age);
    }

    @Override
    public void updatePhone(String username, String phone) {
        userInfoDao.updatePhoneByUserName(username, phone);
    }

    @Override
    public void updateAddress(String username, String address) {
        userInfoDao.updateAddressByUserName(username, address);
    }

    @Override
    public void updateConcern(String username, String avatarPath) {
//        userInfoDao.updateNameByUserId(username, avatarPath);
    }
}
